#!/usr/bin/env python
# -*- coding:utf-8 -*-

from excel.EGC.EgcDictUtil import EgcDictUtil as DictUtil
from excel.PruTuutDb import PruTuutDb

pru_tuut_db_conn = PruTuutDb.get_pool()
dict_db = DictUtil(pru_tuut_db_conn)


# **
# 参考计算EXCEL原文件中列表左侧的数据列
# 释义 =======> 对应列 =======> 公式
class EgaBaseTabTop:

    def __init__(self):
        return

    EgaBaseTabTop = {
        # 粘贴生成的方法内容 -------------------------------------------------------------------------------------------- START
        "Premium_Fin": '',
        "Loan_amount": 0,
        "First_Extral_Withdraw_ANB": 0,
        "Repay_ANB": 0,
        "Saving_Payment_Term": 0,
        "Saving_Sum_Assured_USD": 0,
        "SA": 0,
        "1Y_discount": 0,
        "3Y_discount": 0,
        "5Y_discount": 0,
        "8Y_discount": 0,
        "12Y_discount": 0,
        "EGA_discount": 0,
        "discount_adjusted_premium": 0,
        "discount_adjusted_SA": 0,
        "Chi": 0,
        "Exchange_rate": 0,
        "Display_rate": '',
        "Underlying_currency": 0,
        "Display_currenty": 0,
        "EGA_payment_term_index": '',
        "EGA_currency_index": '',
        "EGA_sum_assured_index": 0,
        "EGA_SA_factor": 0,
        "EGA_annual_premium": 0,
        "EGA_annual_premium_HKD": 0,
        "Adjusted_EGA_CV_col": 0,
        "Adjusted_EGA_G_CV_col": 0,
        "Total_EGA_premium": 0,
        "SA_minimum": 0,
        "low_SA_message": 0,
        "max_withdrawal_age": 0,
        "surrender_value": 0,
        "seed_value": '',
        "max_withdrawal": 0,
        # 粘贴生成的方法内容 --------------------------------------------------------------------------------------------   END
    }

    # 粘贴生成的方法内容 -------------------------------------------------------------------------------------------- START
    # 计算 Premium Fin
    # Params:
    # Premium Fin B18: Premium Fin
    def get_Premium_Fin(self, ):
        # 参考计算公式
        # =AND(C11>0,C6=0)
        return 0

    # 计算 Loan amount
    # Params:
    # Loan amount B19: Loan amount
    def get_Loan_amount(self, ):
        # 参考计算公式
        # =C44*C37*80%*C10
        return 0

    # 计算 First Extral Withdraw ANB
    # Params:
    # First Extral Withdraw ANB B20: First Extral Withdraw ANB
    def get_First_Extral_Withdraw_ANB(self, ):
        # 参考计算公式
        # =MIN(101,M162)
        return 0

    # 计算 Repay ANB
    # Params:
    # Repay ANB B21: Repay ANB
    def get_Repay_ANB(self, ):
        # 参考计算公式
        # 0
        return 0

    # 计算 Saving Payment Term
    # Params:
    # Saving Payment Term B23: Saving Payment Term
    def get_Saving_Payment_Term(self, ):
        # 参考计算公式
        # 
        return 0

    # 计算 Saving Sum Assured USD
    # Params:
    # Saving Sum Assured USD B24: Saving Sum Assured USD
    def get_Saving_Sum_Assured_USD(self, ):
        # 参考计算公式
        # 
        return 0

    # 计算 SA
    # Params:
    # SA B25: SA
    def get_SA(self, ):
        # 参考计算公式
        # =VLOOKUP('SA',data3!A2:IG102,C42,FALSE)*(C5/C37/VLOOKUP('ANB',data3!A2:IG102,C42,FALSE))
        return 0

    # 计算 1Y discount
    # Params:
    # 1Y discount B26: 1Y discount
    def get_1Y_discount(self, ):
        # 参考计算公式
        # 0
        return 0

    # 计算 3Y discount
    # Params:
    # 3Y discount B27: 3Y discount
    def get_3Y_discount(self, ):
        # 参考计算公式
        # =IF(C25/C36>=150000,10.4,IF(C25/C36>=100000,8,IF(C25/C36>=50000,6.8,IF(C25/C36>=35000,5.8,IF(C25/C36>=20000,3.8,0)))))-10.4
        return 0

    # 计算 5Y discount
    # Params:
    # 5Y discount B28: 5Y discount
    def get_5Y_discount(self, ):
        # 参考计算公式
        # =IF(C25/C36>=150000,6.4,IF(C25/C36>=100000,5,IF(C25/C36>=50000,4.2,IF(C25/C36>=35000,3.6,IF(C25/C36>=20000,2.4,0)))))-6.4
        return 0

    # 计算 8Y discount
    # Params:
    # 8Y discount B29: 8Y discount
    def get_8Y_discount(self, ):
        # 参考计算公式
        # =IF(C25/C36>=150000,4,IF(C25/C36>=100000,3.2,IF(C25/C36>=50000,2.6,IF(C25/C36>=35000,2.2,IF(C25/C36>=20000,1.6,0)))))-4
        return 0

    # 计算 12Y discount
    # Params:
    # 12Y discount B30: 12Y discount
    def get_12Y_discount(self, ):
        # 参考计算公式
        # =IF(C25/C36>=150000,3,IF(C25/C36>=100000,2.4,IF(C25/C36>=50000,2,IF(C25/C36>=35000,1.6,IF(C25/C36>=20000,1,0)))))-3
        return 0

    # 计算 EGA discount
    # Params:
    # EGA discount B31: EGA discount
    def get_EGA_discount(self, ):
        # 参考计算公式
        # =IF(C23=1,C26,IF(C23=3,C27,IF(C23=5,C28,IF(C23=8,C29,C30))))
        return 0

    # 计算 discount adjusted premium
    # Params:
    # discount adjusted premium B32: discount adjusted premium
    def get_discount_adjusted_premium(self, ):
        # 参考计算公式
        # =(VLOOKUP('ANB',data3!A2:IG102,C42,FALSE)*1000/VLOOKUP('SA',data3!A2:IG102,C42,FALSE)-C31)*C25/1000
        return 0

    # 计算 discount adjusted SA
    # Params:
    # discount adjusted SA B33: discount adjusted SA
    def get_discount_adjusted_SA(self, ):
        # 参考计算公式
        # =ROUNDUP(C5/(C32*C37)*C25/100,0)*100
        return 0

    # 计算 Chi
    # Params:
    # Chi B35: Chi
    def get_Chi(self, ):
        # 参考计算公式
        # =IF(LOWER(B165)='chi','Yes','No')
        return 0

    # 计算 Exchange rate
    # Params:
    # Exchange rate B36: Exchange rate
    def get_Exchange_rate(self, ):
        # 参考计算公式
        # =IF(LOWER(C8)='hkd',8,1)
        return 0

    # 计算 Display rate
    # Params:
    # Display rate B37: Display rate
    def get_Display_rate(self, ):
        # 参考计算公式
        # =IF(LOWER(C8)='rmb-u',Notes!B2,IF(LOWER(C8)='hkd-u',7.8,1))
        return 0

    # 计算 Underlying currency
    # Params:
    # Underlying currency B38: Underlying currency
    def get_Underlying_currency(self, ):
        # 参考计算公式
        # =IF(LOWER(C8)='rmb-u','(USD)',IF(LOWER(C8)='hkd-u','(USD)',IF(LOWER(C8)='hkd','(HKD)',IF(LOWER(C8)='usd','(USD)'))))
        return 0

    # 计算 Display currenty
    # Params:
    # Display currenty B39: Display currenty
    def get_Display_currenty(self, ):
        # 参考计算公式
        # =IF(LOWER(C8)='rmb-u','(RMB)',IF(LOWER(C8)='hkd-u','(HKD)',IF(LOWER(C8)='hkd','(HKD)',IF(LOWER(C8)='usd','(USD)'))))
        return 0

    # 计算 EGA payment term index
    # Params:
    # EGA payment term index B40: EGA payment term index
    def get_EGA_payment_term_index(self, ):
        # 参考计算公式
        # =IF(C23=1,2,IF(C23=3,4,IF(C23=5,6,IF(C23=8,8,10))))
        return 0

    # 计算 EGA currency index
    # Params:
    # EGA currency index B41: EGA currency index
    def get_EGA_currency_index(self, ):
        # 参考计算公式
        # =IF(C36=1,C40+1,C40+0)
        return 0

    # 计算 EGA sum assured index
    # Params:
    # EGA sum assured index B42: EGA sum assured index
    def get_EGA_sum_assured_index(self, ):
        # 参考计算公式
        # 241
        return 0

    # 计算 EGA SA factor
    # Params:
    # EGA SA factor B43: EGA SA factor
    def get_EGA_SA_factor(self, ):
        # 参考计算公式
        # =C24/VLOOKUP('SA',data3!A2:IG102,C42,FALSE)
        return 0

    # 计算 EGA annual premium
    # Params:
    # EGA annual premium B44: EGA annual premium
    def get_EGA_annual_premium(self, ):
        # 参考计算公式
        # =(VLOOKUP('ANB',data3!A2:IG102,C42,FALSE)*1000/VLOOKUP('SA',data3!A2:IG102,C42,FALSE)-C31)*C24/1000
        return 0

    # 计算 EGA annual premium HKD
    # Params:
    # EGA annual premium HKD B45: EGA annual premium HKD
    def get_EGA_annual_premium_HKD(self, ):
        # 参考计算公式
        # =IF(C36=1,C44*7.8,C44)
        return 0

    # 计算 Adjusted EGA CV col
    # Params:
    # Adjusted EGA CV col B46: Adjusted EGA CV col
    def get_Adjusted_EGA_CV_col(self, ):
        # 参考计算公式
        # =COLUMN(AJ60)-COLUMN(B60)+1
        return 0

    # 计算 Adjusted EGA G CV col
    # Params:
    # Adjusted EGA G CV col B47: Adjusted EGA G CV col
    def get_Adjusted_EGA_G_CV_col(self, ):
        # 参考计算公式
        # =COLUMN(AQ60)-COLUMN(B60)+1
        return 0

    # 计算 Total EGA premium
    # Params:
    # Total EGA premium B48: Total EGA premium
    def get_Total_EGA_premium(self, ):
        # 参考计算公式
        # =SUM(AA62:AA160)
        return 0

    # 计算 SA minimum
    # Params:
    # SA minimum B50: SA minimum
    def get_SA_minimum(self, ):
        # 参考计算公式
        # =IF(C36=1,10000,80000)
        return 0

    # 计算 low SA message
    # Params:
    # low SA message B51: low SA message
    def get_low_SA_message(self, ):
        # 参考计算公式
        # Notional Amount Too Low
        return 0

    # 计算 max withdrawal age
    # Params:
    # max withdrawal age B53: max withdrawal age
    def get_max_withdrawal_age(self, ):
        # 参考计算公式
        # =IF(F8=0,F3,F5+F8-1)
        return 0

    # 计算 surrender value
    # Params:
    # surrender value B54: surrender value
    def get_surrender_value(self, ):
        # 参考计算公式
        # =VLOOKUP(C53,B62:AP162,COLUMN(AP162)-COLUMN(B62)+1,FALSE)
        return 0

    # 计算 seed value
    # Params:
    # seed value B56: seed value
    def get_seed_value(self, ):
        # 参考计算公式
        # =C54/(IF(F8=0,F3-F5+1,F8))
        return 0

    # 计算 max withdrawal
    # Params:
    # max withdrawal B57: max withdrawal
    def get_max_withdrawal(self, ):
        # 参考计算公式
        # =ROUNDDOWN(EA54*C37/1000,0)*1000
        return 0

    # 粘贴生成的方法内容 --------------------------------------------------------------------------------------------   END
